﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;

namespace sonic.Samples.Infrastructure.Model
{
    public class Account : DomainObject
    {
        #region private members
        private string _FirstName;
        private string _LastName;
        private string _Address;
        private Coordinates _CurrentLocation;
        private ObservableCollection<Location> _PastLocations;
        #endregion

        #region constructors
        public Account()
        {
        }
        #endregion

        #region public members

        public string FirstName
        {
            get { return _FirstName; }
            set
            {
                _FirstName = value;
                NotifyPropertyChanged("FirstName");
                NotifyPropertyChanged("DisplayName");
            }
        }
        public string LastName
        {
            get { return _LastName; }
            set
            {
                _LastName = value;
                NotifyPropertyChanged("LastName");
                NotifyPropertyChanged("DisplayName");
            }
        }
        public string Address
        {
            get { return _Address; }
            set
            {
                _Address = value;
                NotifyPropertyChanged("Address");
            }
        }

        public Coordinates CurrentLocation
        {
            get
            {
                if (null == _CurrentLocation)
                {
                    _CurrentLocation = new Coordinates();
                }
                return _CurrentLocation;
            }
            set
            {
                _CurrentLocation = value;
                NotifyPropertyChanged("CurrentLocation");
            }
        }

        public ObservableCollection<Location> PastLocations
        {
            get { return _PastLocations; }
            set
            {
                _PastLocations = value;
                NotifyPropertyChanged("PastLocations");
            }
        }

        public override string DisplayName
        {
            get
            {
                return string.Format("{0} {1}", this.LastName, this.FirstName);
            }
            set
            {
                ;
            }
        }
        #endregion
    }
}
